library(stargazer)

source("sccbs_recodes.R")

mobility.model.step1 <- glmer(exit ~ fb_d + (1|community), family = binomial(link = "logit"), nAGQ=0, control=glmerControl(optimizer = "nloptwrap"))

mobility.model.step2 <- glmer(exit ~ fb_d + fb_lag + (1|community), family = binomial(link = "logit"), nAGQ=0, control=glmerControl(optimizer = "nloptwrap"))

mobility.model.step3 <- glmer(exit ~ fb_d*fb_lag + (1|community), family = binomial(link = "logit"), nAGQ=0, control=glmerControl(optimizer = "nloptwrap"))

mobility.model.step4 <- glmer(exit ~ fb_d*fb_lag + tenure + (1|community), family = binomial(link = "logit"), nAGQ=0, control=glmerControl(optimizer = "nloptwrap"))

mobility.model.full <- glmer(exit ~ fb_d*fb_lag + age + education + tenure + ideology + income + gender + own + kids + hispanic + asian + pctunemp + pcthisp + pctasian + medhsvl + (1|community), family = binomial(link = "logit"), nAGQ=0, control=glmerControl(optimizer = "nloptwrap"))

stargazer(mobility.model.step1, mobility.model.step2, mobility.model.step3, mobility.model.step4, mobility.model.full, covariate.labels = c("Delta Immigrant", "Surrounding Composition", "Age", "Education", "Tenure", "Ideology", "Income", "Gender", "Homeowner", "Parent", "Hispanic", "Asian", "Pct. Unemployed", "Pct. Hispanic", "Pct. Asian", "Median Housing Value", "Delta Immigrant x Surrounding Composition", "Intercept"), single.row = TRUE, no.space = TRUE, digits = 2)

expression.model.step1 <- clmm(factor(immig) ~ fb_d + (1|community), subset = citizen == 1, link = "logit", nAGQ=0, control=glmerControl(optimizer = "nloptwrap"))

expression.model.step2 <- clmm(factor(immig) ~ fb_d + fb_lag + (1|community), subset = citizen == 1, link = "logit", nAGQ=0, control=glmerControl(optimizer = "nloptwrap"))

expression.model.step3 <- clmm(factor(immig) ~ fb_d*fb_lag + (1|community), subset = citizen == 1, link = "logit", nAGQ=0, control=glmerControl(optimizer = "nloptwrap"))

expression.model.step4 <- clmm(factor(immig) ~ fb_d*fb_lag + ideology + (1|community), subset = citizen == 1, link = "logit", nAGQ=0, control=glmerControl(optimizer = "nloptwrap"))

expression.model.full <- clmm(factor(immig) ~ fb_d*fb_lag + age + education + tenure + ideology + income + gender + own + kids + hispanic + asian + pctunemp + pcthisp + pctasian + medhsvl + (1|community), subset = citizen == 1, link = "logit", nAGQ=0, control=glmerControl(optimizer = "nloptwrap"))

stargazer(fake.clm(expression.model.step1), fake.clm(expression.model.step2), fake.clm(expression.model.step3), fake.clm(expression.model.step4), fake.clm(expression.model.full), covariate.labels = c("Delta Immigrant", "Surrounding Composition", "Age", "Education", "Tenure", "Ideology", "Income", "Gender", "Homeowner", "Parent", "Hispanic", "Asian", "Pct. Unemployed", "Pct. Hispanic", "Pct. Asian", "Median Housing Value", "Delta Immigrant x Surrounding Composition", "Intercept"), no.space = TRUE, single.row = TRUE, digits = 2)



